package j06fanxing;

class C<T>{
    void f1(T t){
        System.out.println("t = " + t);
    }
}
public class J3 {
    public static void main(String[] args) {
        new C().f1(4);
        new C<String>().f1("abc");
        System.out.println("=====");
        //匿名内部类
        new C<Character>(){
            @Override
            void f1(Character character) {
                System.out.println("character = " + character);
            }
        }.f1('m');
    }
}

class J4{
    void f1(int num){
        System.out.println("num = " + num);
    }

    <T> void f2(T t){
        System.out.println("t = " + t);
    }

    static <V> void f3(V v){
        System.out.println("v = " + v);
    }
}

class J4Test{
    public static void main(String[] args) {
        J4 j4 = new J4();
        //简写
        j4.f2(4);
        j4.f2("abc");
        j4.f2(true);
        //完整写法
        j4.<Character>f2('f');
        System.out.println("========");
        J4.f3(55);
        J4.f3("nn");
        J4.<String>f3("nn");
    }
}